﻿using netCoreStudy.Dto.User;
using netCoreStudy.Entities;

namespace netCoreStudy.Profile
{
	public class UserRoleProfile : AutoMapper.Profile
	{
		public UserRoleProfile()
		{
			CreateMap<UserRole, UserRoleDto>();
			CreateMap<UserRoleDto, UserRole>();
			CreateMap<UserRole, RoleDtoSm>()
				.ForMember(d => d.Id,
				o => o.MapFrom(
					s => s.Role.Id
				))
				.ForMember(d => d.Name,
				o => o.MapFrom(
					s => s.Role.Name
				))
				;
		}
	}
}